#pragma once 

#include<iostream>
#include<string>
#include<vector>
#include<unistd.h>
#include<cassert>
#include <sys/types.h>
#include <sys/wait.h>
using namespace std;

//每个command都必须是4字节
#define COMMAND_LOG 0
#define COMMAND_MYSQL 1
#define COMMAND_REQUEST 2

typedef void (*fun_t)();

void PrintLog()
{
    cout<<"打印日志任务，正在被执行"<<endl;
}
void InsertMySQL()
{
    cout<<"打印数据库任务，正在被执行"<<endl;
}
void NetRequest()
{
    cout<<"打印网络请求任务，正在被执行"<<endl;
}

class Task
{
public:
    Task()
    {
        funcs.push_back(PrintLog);
        funcs.push_back(InsertMySQL);
        funcs.push_back(NetRequest);
    }
    void Execute (int command)
    {
        if(command >= 0 && command < funcs.size())
        {
            //执行对应的方法
            funcs[command]();
        }
    }
    ~Task()
    {}
    vector<fun_t> funcs;
};